<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
 var stu = {
    id: 1000,
    name: 'temo',
    _money: 8000
};

Object.defineProperty(stu,'_money',{
    enumerable: false
})

//加个访问器属性
Object.defineProperty(stu,'bank',{
    get:function(){
        console.log('建行余额=', this._money);
    },
    set:function(v){
        if(v<= -500){
            console.log('不允许大额取钱');
            return ;
        }
        this._money += v;
        console.log('修改余额=', this._money);
    },
    enumerable: true,
    configurable: true
})

// stu._money = 0 ;
stu.bank = 800;
console.log( stu );

for(let s in stu){
    console.log( s );
}


</script>
</body>
</html>